
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;

import javax.swing.JPanel;

@SuppressWarnings("serial")
public class GUI extends JPanel {
    
    
    final static float dash1[] = {3.0f};
    final static BasicStroke dashed = new BasicStroke(1.0f,
                                          BasicStroke.CAP_BUTT,
                                          BasicStroke.JOIN_MITER,
                                          10.0f, dash1, 0.0f);


    public void paint(Graphics g)
    {
        super.paint(g);
        
        Graphics2D g2 = (Graphics2D)g;

        if(!game.gameover)
        {
            

            
            g2.drawString("Next Shape:", 240, 30);
            g2.drawString("Current Score:", 240, 140);
            g2.drawString(Integer.toString(board.score), 240, 160);
            g2.drawString("Level:", 240, 180);
            g2.drawString(Integer.toString(board.level), 240, 200);
            g2.drawString("High Scores:", 240, 250);

            for (int a=0; a<board.board[0].length; a++)
            {
                for(int b=2; b<board.board.length; b++)
                {

                    if(board.board[b][a]!=0)
                    {
                        
                        if(board.board[b][a]==1)
                        {
                            g2.setColor(Color.RED);
                            g2.fill3DRect(a*20+10, b*20-30, 20, 20,true);
                        }
                        else if(board.board[b][a]==2)
                        {
                            g2.setColor(Color.BLUE);
                            g2.fill3DRect(a*20+10, b*20-30, 20, 20,true);
                        }
                        else if(board.board[b][a]==3)
                        {
                            g2.setColor(Color.YELLOW);
                            g2.fill3DRect(a*20+10, b*20-30, 20, 20,true);
                        }
                        else if(board.board[b][a]==4)
                        {
                            g2.setColor(Color.GREEN);
                            g2.fill3DRect(a*20+10, b*20-30, 20, 20,true);
                        }
                        else if(board.board[b][a]==5)
                        {
                            g2.setColor(Color.ORANGE);
                            g2.fill3DRect(a*20+10, b*20-30, 20, 20,true);
                        }
                        else if(board.board[b][a]==6)
                        {
                            g2.setColor(Color.BLACK);
                            g2.fill3DRect(a*20+10, b*20-30, 20, 20,true);
                        }
                        else if(board.board[b][a]==7)
                        {
                            g2.setColor(Color.CYAN);
                            g2.fill3DRect(a*20+10, b*20-30, 20, 20,true);
                        }
                        else if(board.board[b][a]==8)
                        {
                            g2.setColor(Color.GRAY);
                            g2.fill3DRect(a*20+10, b*20-30, 20, 20,true);
                        }
                        else if(board.board[b][a]==9)
                        {
                            g2.setColor(Color.PINK);
                            g2.fill3DRect(a*20+10, b*20-30, 20, 20,true);
                        }
                        else if(board.board[b][a]==10)
                        {
                            g2.setColor(Color.MAGENTA);
                            g2.fill3DRect(a*20+10, b*20-30, 20, 20,true);
                        }
                        else if(board.board[b][a]==11)
                        {
                            g2.setColor(Color.LIGHT_GRAY);
                            g2.fill3DRect(a*20+10, b*20-30, 20, 20,true);
                        }
                        else
                        {
                            g2.setColor(Color.DARK_GRAY);
                            g2.fill3DRect(a*20+10, b*20-30, 20, 20,true);
                        }

                        


                        //g2.fillRect (a*20+10, b*20+10, 20, 20);
                    }
                }
            }
            g2.setColor(Color.BLACK);
            g2.setStroke(dashed);

            g2.drawRect (10, 10, 200, 360);
            g.dispose();
            g2.dispose();

        }
        else
        {
            g2.drawString("Game Over!", 50, 30);
            g2.drawString("Your score:", 50, 140);
            g2.drawString(Score.getName()+"'s score is:" + Integer.toString(Score.getScore()), 50, 160);
            
            
        }
    }
}
